package edu.uclmgmu.bacteriosec.aspects.java.io.InputStream;

import java.io.*;

import edu.uclmgmu.bacteriosec.aspects.common.Store;

privileged aspect InputStream_CountCalls {
	
	int around(java.io.InputStream caller) : call(int java.io.InputStream.available()) && 
			target(caller) && 
			!cflow(within(InputStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		return proceed(caller);
	}
	
	int around(java.io.InputStream caller, byte[] a, int b, int c) : call(int java.io.InputStream.read(byte[], int, int)) && 
			target(caller) && args(a, b, c) &&
			!cflow(within(InputStream_CountCalls)) && !within(edu.uclmgmu.bacteriosec.aspects.common.Store) 
			&& !within(junit.*) {
		Store.updateNumberOfCalls(thisJoinPointStaticPart.getSignature().toString());
		return proceed(caller, a, b, c);
	}
}
